home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-03 | 43.9 KB | 1,547 lines | [TEXT/MPS ] |
- //----------------------------------------------------------------------------------------
- // UFile.cp
- // Copyright © 1988-96 by Apple Computer, Inc. All rights reserved.
- //----------------------------------------------------------------------------------------
-
- #ifndef __UFILE__
- #include "UFile.h"
- #endif
-
- // MacApp
-
- #ifndef __UAPPLEEVENTS__
- #include "UAppleEvents.h"
- #endif
-
- #ifndef __UCOREERRORMGR__
- #include "UCoreErrorMgr.h"
- #endif
-
- #ifndef __UCOREGLOBALS__
- #include "UCoreGlobals.h"
- #endif
-
- #ifndef __UCOREUTILITIES__
- #include "UCoreUtilities.h"
- #endif
-
- // #ifndef __UDISPATCHER__
- // #include "UDispatcher.h"
- // #endif
-
- // #ifndef __UERRORMGR__
- // #include "UErrorMgr.h"
- // #endif
-
- #ifndef __UMACAPPGLOBALS__
- #include "UMacAppGlobals.h"
- #endif
-
- #ifndef __UMACAPPUTILITIES__
- #include "UMacAppUtilities.h"
- #endif
-
- // Toolbox
-
- #ifndef __AEREGISTRY__
- #include <AERegistry.h>
- #endif
-
- #ifndef __DEVICES__
- #include <Devices.h>
- #endif
-
- #ifndef __ERRORS__
- #include <Errors.h>
- #endif
-
- #ifndef __FILES__
- #include <Files.h>
- #endif
-
- #ifndef __FINDER__
- #include <Finder.h>
- #endif
-
- #ifndef __RESOURCES__
- #include <Resources.h>
- #endif
-
- #ifndef __SCRIPT__
- #include <Script.h>
- #endif
-
- // ANSI
-
- #ifndef __STDIO__
- #include <stdio.h>
- #endif
-
- //========================================================================================
- // GLOBAL Procedures
- //========================================================================================
- #undef Inherited
-
- //----------------------------------------------------------------------------------------
- // NewFile:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileOpen
-
- TFile* NewFile(OSType itsFileType,
- OSType itsCreator,
- Boolean usesDataFork,
- ResourceUsage usesRsrcFork,
- Boolean keepsDataOpen,
- Boolean keepsRsrcOpen)
- {
- TFile * theFile;
-
- theFile = new TFile;
- theFile->IFile(itsFileType, itsCreator, usesDataFork, usesRsrcFork, keepsDataOpen, keepsRsrcOpen);
- return theFile;
- } // NewFile
-
-
- //========================================================================================
- // CLASS TFile
- //========================================================================================
- #undef Inherited
- #define Inherited TObject
-
- #pragma segment MAFileOpen
- MA_DEFINE_CLASS_M2(TFile, Inherited, MScriptableObject);
-
- //----------------------------------------------------------------------------------------
- // TFile constructor
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileOpen
-
- TFile::TFile()
- : MScriptableObject(cFile)
- {
- fFileSpec.vRefNum = 0;
- fFileSpec.parID = 0;
- fFileSpec.name[0] = '\0';
-
- fModDate = 0;
- fStationery = FALSE;
- fFileType = kGenericType;
- fCreator = kGenericCreator;
- fScriptTag = smSystemScript;
- fUsesDataFork = FALSE;
- fUsesRsrcFork = noResourceFork;
- fDataPermission = fsRdPerm;
- fRsrcPermission = fsRdPerm;
- fKeepDataOpen = FALSE;
- fKeepRsrcOpen = FALSE;
- fDataRefNum = kNoFileRefnum;
- fRsrcRefNum = kNoFileRefnum;
- fAlias = NULL;
- } // TFile::TFile
-
- //----------------------------------------------------------------------------------------
- // TFile::IFile:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileOpen
-
- void TFile::IFile(OSType itsFileType,
- OSType itsCreator,
- Boolean usesDataFork,
- ResourceUsage usesRsrcFork,
- Boolean keepsDataOpen,
- Boolean keepsRsrcOpen)
- {
- this->IObject();
-
- #if qDebugMsg
- if (keepsDataOpen &&!usesDataFork)
- {
- fprintf(stderr, "In TFile::IFile: keepsDataOpen && !usesDataFork;\n");
- fprintf(stderr, "In TFile::IFile: usesDataFork = true;\n");
- usesDataFork = TRUE;
- }
- if (keepsRsrcOpen && (usesRsrcFork == noResourceFork))
- {
- fprintf(stderr, "In TFile::IFile: keepsRsrcOpen && (usesRsrcFork == noResourceFork);\n");
- fprintf(stderr, "In TFile::IFile: usesRsrcFork = preferResourceFork;\n");
- usesRsrcFork = preferResourceFork;
- }
- #endif
-
- fFileType = itsFileType;
- fCreator = itsCreator;
- fUsesDataFork = usesDataFork;
- fUsesRsrcFork = usesRsrcFork;
- fKeepDataOpen = keepsDataOpen;
- fKeepRsrcOpen = keepsRsrcOpen;
- } // TFile::IFile
-
- //----------------------------------------------------------------------------------------
- // TFile::Free:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileClose
-
- TFile::~TFile()
- {
- this->CloseFile();
-
- if (fAlias != NULL)
- fAlias = (AliasHandle)DisposeIfHandle((Handle)fAlias);
- } // TFile::Free
-
- //----------------------------------------------------------------------------------------
- // TFile::Specify:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- void TFile::Specify(const FSSpec& theFile)
- {
- // If we are re-specifying an open file, close the file
- this->CloseFile();
- fFileSpec = theFile;
-
- if (fAlias != NULL)
- fAlias = (AliasHandle)DisposeIfHandle((Handle)fAlias);
-
- FInfo info;
- OSErr anErr = this->GetFinderInfo(info);
- if (anErr == noErr)
- FailOSErr(NewAliasMinimal(&theFile, &fAlias));
- else if (anErr != fnfErr)
- FailOSErr(anErr);
- } // TFile::Specify
-
- //----------------------------------------------------------------------------------------
- // TFile::SpecifyWithStandardFileReply:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- void TFile::SpecifyWithStandardFileReply(const StandardFileReply& itsReply)
- {
- this->Specify(itsReply.sfFile);
-
- fFileType = itsReply.sfType; // only valid for StandardGetFile & CustomGetFile
- fScriptTag = itsReply.sfScript;
- if (itsReply.sfFlags & kIsStationary) // only valid for StandardGetFile & CustomGetFile
- fStationery = TRUE;
- } // TFile::SpecifyWithStandardFileReply
-
- //----------------------------------------------------------------------------------------
- // TFile::SpecifyWithSFReply:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- OSErr TFile::SpecifyWithSFReply(const SFReply& itsReply)
- {
- OSErr theErr = this->SpecifyWithTrio(itsReply.vRefNum, 0, itsReply.fName);
-
- fFileType = itsReply.fType;
- return theErr;
- } // TFile::SpecifyWithSFReply
-
- //----------------------------------------------------------------------------------------
- // TFile::SpecifyWithAlias:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- OSErr TFile::SpecifyWithAlias(AliasHandle alias)
- {
- FSSpec theFileSpec;
- Boolean dontCare;
-
- OSErr theErr = ResolveAlias((FSSpecPtr)NULL, alias, &theFileSpec, &dontCare);
- if (theErr == noErr)
- {
- FInfo finderInfo;
- FXInfo xFinderInfo;
- Boolean isDirectory;
-
- fFileType = kGenericType; // Since we don't know, set to original values
- fCreator = kGenericCreator;
- fStationery = FALSE;
-
- this->Specify(theFileSpec);
- if (this->GetFinderInfo(finderInfo, xFinderInfo, isDirectory) == noErr)
- {
- if (isDirectory)
- {
- fFileType = kFolderType;
- fCreator = kFolderCreator;
- }
- else
- {
- fFileType = finderInfo.fdType;
- fCreator = finderInfo.fdCreator;
- fStationery = ((finderInfo.fdFlags & kIsStationary) != 0);
- }
- }
- }
-
- return theErr;
- } // TFile::SpecifyWithAlias
-
- //----------------------------------------------------------------------------------------
- // TFile::SpecifyWithFile:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- void TFile::SpecifyWithFile(TFile* aFile)
- {
- aFile->UpdateFileSpec(); // Insure its specs are up-to-date.
- FSSpec theFile = aFile->fFileSpec;
-
- this->Specify(theFile);
-
- fFileType = aFile->fFileType;
- fCreator = aFile->fCreator;
- fScriptTag = aFile->fScriptTag;
- fStationery = aFile->fStationery;
- } // TFile::SpecifyWithFile
-
- //----------------------------------------------------------------------------------------
- // TFile::SpecifyWithTrio:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- OSErr TFile::SpecifyWithTrio(short volRefNum,
- long dirID,
- const CStr63& name)
- {
- FSSpec theFileSpec;
- OSErr theErr = noErr;
-
- if ((theErr = FSMakeFSSpec(volRefNum, dirID, name, &theFileSpec)) == fnfErr)
- theErr = noErr; // The file may not yet exist
-
- if (theErr == noErr)
- this->Specify(theFileSpec);
- return theErr;
- } // TFile::SpecifyWithTrio
-
- //----------------------------------------------------------------------------------------
- // TFile::CloseFile:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileClose
-
- OSErr TFile::CloseFile()
- {
- OSErr dataErr = noErr;
- OSErr rsrcErr = noErr;
-
- if (fUsesDataFork)
- dataErr = this->CloseDataFork();
- if (fUsesRsrcFork != noResourceFork)
- {
- rsrcErr = this->CloseRsrcFork();
- if ((fUsesRsrcFork == preferResourceFork) && (rsrcErr == resFNotFound))
- rsrcErr = noErr;
- }
-
- if (dataErr != noErr)
- return dataErr;
- else
- return rsrcErr;
- } // TFile::CloseFile
-
- //----------------------------------------------------------------------------------------
- // TFile::CloseFileIfNotKeptOpen:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileClose
-
- OSErr TFile::CloseFileIfNotKeptOpen()
- {
- OSErr dataErr = noErr;
- OSErr rsrcErr = noErr;
-
- if (fUsesDataFork && !fKeepDataOpen)
- dataErr = this->CloseDataFork();
- if ((fUsesRsrcFork != noResourceFork) && !fKeepRsrcOpen)
- {
- rsrcErr = this->CloseRsrcFork();
- if ((fUsesRsrcFork == preferResourceFork) && (rsrcErr == resFNotFound))
- rsrcErr = noErr;
- }
-
- if (dataErr != noErr)
- return dataErr;
- else
- return rsrcErr;
- } // TFile::CloseFileIfNotKeptOpen
-
- //----------------------------------------------------------------------------------------
- // TFile::CloseDataFork:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileClose
-
- OSErr TFile::CloseDataFork()
- {
- OSErr theErr = noErr;
-
- if (fDataRefNum != kNoFileRefnum)
- {
- theErr = FSClose(fDataRefNum);
- fDataRefNum = kNoFileRefnum;
- }
- return theErr;
- } // TFile::CloseDataFork
-
- //----------------------------------------------------------------------------------------
- // TFile::CloseRsrcFork:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileClose
-
- OSErr TFile::CloseRsrcFork()
- {
- OSErr theErr = noErr;
-
- if (fRsrcRefNum != kNoFileRefnum)
- {
- CloseResFile(fRsrcRefNum);
- theErr = ResError();
- fRsrcRefNum = kNoFileRefnum;
- }
- return theErr;
- } // TFile::CloseRsrcFork
-
- //----------------------------------------------------------------------------------------
- // TFile::CreateFile:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileOpen
-
- OSErr TFile::CreateFile()
- {
- OSErr dataErr = noErr;
- OSErr rsrcErr = noErr;
-
- if (fUsesDataFork)
- dataErr = this->CreateDataFork();
-
- if (fUsesRsrcFork != noResourceFork)
- rsrcErr = this->CreateRsrcFork();
-
- if (dataErr != noErr)
- return dataErr;
- else
- return rsrcErr;
- } // TFile::CreateFile
-
- //----------------------------------------------------------------------------------------
- // TFile::CreateDataFork:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileOpen
-
- OSErr TFile::CreateDataFork()
- {
- return FSpCreate(&fFileSpec, fCreator, fFileType, fScriptTag);
- } // TFile::CreateDataFork
-
- //----------------------------------------------------------------------------------------
- // TFile::CreateRsrcFork:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileOpen
-
- OSErr TFile::CreateRsrcFork()
- {
- FSpCreateResFile(&fFileSpec, fCreator, fFileType, fScriptTag);
-
- return ResError();
- } // TFile::CreateRsrcFork
-
- //----------------------------------------------------------------------------------------
- // TFile::DeleteFile:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileClose
-
- OSErr TFile::DeleteFile()
- {
- fModDate = 0;
- if (fAlias != NULL)
- fAlias = (AliasHandle)DisposeIfHandle((Handle)fAlias);
-
- return FSpDelete(&fFileSpec);
- } // TFile::DeleteFile
-
- //----------------------------------------------------------------------------------------
- // TFile::OpenFile:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileOpen
-
- OSErr TFile::OpenFile()
- {
- OSErr dataErr = noErr;
- OSErr rsrcErr = noErr;
-
- if (fUsesDataFork)
- dataErr = this->OpenDataFork(fDataPermission);
-
- if (fUsesRsrcFork != noResourceFork)
- {
- rsrcErr = this->OpenRsrcFork(fRsrcPermission);
- if ((fUsesRsrcFork == preferResourceFork) && (rsrcErr != noErr))
- rsrcErr = noErr;
- }
-
- if (dataErr != noErr)
- return dataErr;
- else
- return rsrcErr;
- } // TFile::OpenFile
-
- //----------------------------------------------------------------------------------------
- // TFile::OpenFileIfKeptOpen:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileOpen
-
- OSErr TFile::OpenFileIfKeptOpen()
- {
- OSErr dataErr = noErr;
- OSErr rsrcErr = noErr;
-
- if (fUsesDataFork && fKeepDataOpen)
- dataErr = this->OpenDataFork(fDataPermission);
-
- if ((fUsesRsrcFork != noResourceFork) && fKeepRsrcOpen)
- {
- rsrcErr = this->OpenRsrcFork(fRsrcPermission);
- if ((fUsesRsrcFork == preferResourceFork) && (rsrcErr != noErr))
- rsrcErr = noErr;
- }
-
- if (dataErr != noErr)
- return dataErr;
- else
- return rsrcErr;
- } // TFile::OpenFileIfKeptOpen
-
- //----------------------------------------------------------------------------------------
- // TFile::OpenDataFork:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileOpen
-
- OSErr TFile::OpenDataFork(SignedByte permission)
- {
- OSErr theErr = noErr;
-
- if (fDataRefNum == kNoFileRefnum) // Don't open if already open
- {
- HParamBlockRec pb;
- CStr63 fileName = fFileSpec.name;
-
- BlockSet((Ptr) & pb, sizeof(HParamBlockRec), 0x00);
- pb.accessParam.ioNamePtr = (StringPtr) fileName;
- pb.accessParam.ioVRefNum = fFileSpec.vRefNum;
- pb.fileParam.ioDirID = fFileSpec.parID;
-
- switch (permission)
- {
- // read/deny write
- case fsRdPerm:
- pb.accessParam.ioDenyModes = fsRdPerm | 32;
- break;
-
- // read/write/deny read/deny write
- case fsWrPerm:
- case fsRdWrPerm:
- case fsCurPerm:
- pb.accessParam.ioDenyModes = fsRdWrPerm | 16 | 32;
- break;
-
- // read/write/deny none
- case fsRdWrShPerm:
- pb.accessParam.ioDenyModes = fsRdWrPerm;
- break;
-
- // read/deny write
- default:
- pb.accessParam.ioDenyModes = fsRdPerm | 32;
- }
-
- theErr = PBHOpenDenySync(&pb); // Try the shared volume open.
-
- if ((theErr == paramErr) || (theErr == wPrErr)) // Not on a shared volume, try HFS open.
- {
- pb.ioParam.ioPermssn = permission & 3;
- theErr = PBHOpenSync(&pb);
- }
-
- if (theErr == noErr)
- fDataRefNum = pb.ioParam.ioRefNum;
- }
-
- return theErr;
- } // TFile::OpenDataFork
-
- //----------------------------------------------------------------------------------------
- // TFile::OpenRsrcFork:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileOpen
-
- OSErr TFile::OpenRsrcFork(SignedByte permission)
- {
- OSErr theErr = noErr;
-
- if (fRsrcRefNum == kNoFileRefnum) // Don't open if already open
- {
- fRsrcRefNum = FSpOpenResFile(&fFileSpec, (permission & 7));
- theErr = ResError();
- }
- if (theErr != noErr)
- fRsrcRefNum = kNoFileRefnum;
- return theErr;
- } // TFile::OpenRsrcFork
-
- //----------------------------------------------------------------------------------------
- // TFile::ExchangeFiles:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileWrite
-
- OSErr TFile::ExchangeFiles(TFile* aFile)
- {
- return FSpExchangeFiles(&fFileSpec, &aFile->fFileSpec);
- } // TFile::ExchangeFiles
-
- //----------------------------------------------------------------------------------------
- // TFile::GetAlias:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- OSErr TFile::GetAlias(AliasHandle& alias)
- {
- return NewAliasMinimal(&fFileSpec, &alias);
- } // TFile::GetAlias
-
- //----------------------------------------------------------------------------------------
- // TFile::GetCatInfo:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- OSErr TFile::GetCatInfo(CInfoPBRec& cInfo)
- {
- CStr63 itsName;
-
- itsName = fFileSpec.name;
- cInfo.hFileInfo.ioNamePtr = (StringPtr) itsName;
- cInfo.hFileInfo.ioVRefNum = fFileSpec.vRefNum;
- cInfo.hFileInfo.ioFDirIndex = 0;
- cInfo.hFileInfo.ioDirID = fFileSpec.parID;
- OSErr err = PBGetCatInfoSync(&cInfo);
- cInfo.hFileInfo.ioNamePtr = NULL;
- return err;
- } // TFile::GetCatInfo
-
- //----------------------------------------------------------------------------------------
- // TFile::GetCreationDate:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- long TFile::GetCreationDate()
- {
- long returnVal = 0;
-
- CInfoPBRec cInfo;
-
- BlockSet((Ptr) & cInfo, sizeof(CInfoPBRec), 0x00);// zero-out our storage
- if (this->GetCatInfo(cInfo) == noErr)
- {
- Boolean isDirectory = ((cInfo.hFileInfo.ioFlAttrib & ioDirMask) != 0);
- if (isDirectory)
- returnVal = cInfo.dirInfo.ioDrCrDat;
- else
- returnVal = cInfo.hFileInfo.ioFlCrDat;
- }
-
- return returnVal;
- } // TFile::GetCreationDate
-
- //----------------------------------------------------------------------------------------
- // TFile::GetDataLength:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileRead
-
- OSErr TFile::GetDataLength(long& length)
- {
- return GetEOF(fDataRefNum, &length);
- } // TFile::GetDataLength
-
- //----------------------------------------------------------------------------------------
- // TFile::GetDataMark:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileRead
-
- OSErr TFile::GetDataMark(long& mark)
- {
- return GetFPos(fDataRefNum, &mark);
- } // TFile::GetDataMark
-
- //----------------------------------------------------------------------------------------
- // TFile::GetDirID:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileRes
-
- long TFile::GetDirID()
- {
- return fFileSpec.parID;
- } // TFile::GetDirID
-
- //----------------------------------------------------------------------------------------
- // TFile::GetFileCreator:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- OSErr TFile::GetFileCreator(OSType& creator)
- {
- FInfo finderInfo;
- FXInfo xFinderInfo;
- Boolean isDirectory;
-
- OSErr theErr = this->GetFinderInfo(finderInfo, xFinderInfo, isDirectory);
- if (theErr == noErr)
- {
- if (isDirectory)
- creator = kFolderCreator;
- else
- creator = finderInfo.fdCreator;
- }
- else
- creator = kGenericCreator;
-
- return theErr;
- } // TFile::GetFileCreator
-
- //----------------------------------------------------------------------------------------
- // TFile::GetFileInfo:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- OSErr TFile::GetFileInfo(HParamBlockRec& pb)
- {
- CStr63 itsName;
-
- itsName = fFileSpec.name;
- pb.fileParam.ioNamePtr = (StringPtr) itsName;
- pb.fileParam.ioVRefNum = fFileSpec.vRefNum;
- pb.fileParam.ioDirID = fFileSpec.parID;
- pb.fileParam.ioFVersNum = 0;
- pb.fileParam.ioFDirIndex = 0;
- OSErr err = PBHGetFInfoSync(&pb);
- pb.fileParam.ioNamePtr = NULL;
- return err;
- } // TFile::GetFileInfo
-
- //----------------------------------------------------------------------------------------
- // TFile::GetFileType:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- OSErr TFile::GetFileType(OSType& fileType)
- {
- FInfo finderInfo;
- FXInfo xFinderInfo;
- Boolean isDirectory;
-
- OSErr theErr = this->GetFinderInfo(finderInfo, xFinderInfo, isDirectory);
- if (theErr == noErr)
- {
- if (isDirectory)
- fileType = kFolderType;
- else
- fileType = finderInfo.fdType;
- }
- else
- fileType = '\?\?\?\?';
-
- return theErr;
- } // TFile::GetFileType
-
- //----------------------------------------------------------------------------------------
- // TFile::GetFileSpec:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileRes
-
- void TFile::GetFileSpec(FSSpec& theFileSpec)
- {
- theFileSpec = fFileSpec;
- } // TFile::GetFileSpec
-
- //----------------------------------------------------------------------------------------
- // TFile::GetFinderInfo:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- OSErr TFile::GetFinderInfo(FInfo& fndrInfo)
- {
- #if 0
- return FSpGetFInfo(&fFileSpec, &fndrInfo);
- #else
- FXInfo itsFXInfo;
- Boolean isDirectory;
- return GetFinderInfo(fndrInfo, itsFXInfo, isDirectory);
- #endif
- } // TFile::GetFinderInfo
-
- //----------------------------------------------------------------------------------------
- // TFile::GetFinderInfo:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- OSErr TFile::GetFinderInfo(FInfo& fndrInfo, FXInfo& itsFXInfo, Boolean& isDirectory)
- {
- CInfoPBRec cInfo;
-
- BlockSet((Ptr) & cInfo, sizeof(CInfoPBRec), 0x00);// zero-out our storage
- cInfo.hFileInfo.ioCompletion = NULL;
- cInfo.hFileInfo.ioNamePtr = (unsigned char*)&fFileSpec.name;
- cInfo.hFileInfo.ioVRefNum = fFileSpec.vRefNum;
- cInfo.hFileInfo.ioFDirIndex = 0;
- cInfo.hFileInfo.ioDirID = fFileSpec.parID;
-
- PBGetCatInfoSync(&cInfo);
-
- if (cInfo.hFileInfo.ioResult == noErr)
- {
- isDirectory = ((cInfo.hFileInfo.ioFlAttrib & ioDirMask) != 0);
- if (isDirectory)
- {
- fndrInfo = *(FInfo*)&cInfo.dirInfo.ioDrUsrWds;
- itsFXInfo = *(FXInfo*)&cInfo.dirInfo.ioDrFndrInfo;
- }
- else
- {
- fndrInfo = cInfo.hFileInfo.ioFlFndrInfo;
- itsFXInfo = cInfo.hFileInfo.ioFlXFndrInfo;
- }
- }
-
- return cInfo.hFileInfo.ioResult;
- } // TFile::GetFinderInfo
-
- //----------------------------------------------------------------------------------------
- // TFile::GetModificationDate:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- long TFile::GetModificationDate()
- {
- long returnVal = 0;
-
- CInfoPBRec cInfo;
-
- BlockSet((Ptr) & cInfo, sizeof(CInfoPBRec), 0x00);// zero-out our storage
- if (this->GetCatInfo(cInfo) == noErr)
- {
- Boolean isDirectory = ((cInfo.hFileInfo.ioFlAttrib & ioDirMask) != 0);
- if (isDirectory)
- returnVal = cInfo.dirInfo.ioDrMdDat;
- else
- returnVal = cInfo.hFileInfo.ioFlMdDat;
- }
-
- return returnVal;
- } // TFile::GetModificationDate
-
- //----------------------------------------------------------------------------------------
- // TFile::GetName:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileRes
-
- void TFile::GetName(CStr63& name)
- {
- name = fFileSpec.name;
- } // TFile::GetName
-
- //----------------------------------------------------------------------------------------
- // TFile::GetPathName:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileWrite
-
- OSErr TFile::GetPathName(CStr255& pathName)
- {
- CStr63 dirName;
-
- pathName.Empty();
-
- CStr2 delimiter = HasAUX() ? "/" : ":";
-
- CInfoPBRec cInfoPB;
- cInfoPB.dirInfo.ioFDirIndex = -1;
- cInfoPB.dirInfo.ioVRefNum = fFileSpec.vRefNum;
- cInfoPB.dirInfo.ioDrDirID = fFileSpec.parID;
- cInfoPB.dirInfo.ioNamePtr = (StringPtr) dirName;
-
- OSErr err = noErr;
- while (err == noErr)
- {
- err = PBGetCatInfoSync(&cInfoPB);
- pathName.Insert(dirName + delimiter, 1);
- if (cInfoPB.dirInfo.ioDrDirID == fsRtDirID)
- break;
-
- cInfoPB.dirInfo.ioDrDirID = cInfoPB.dirInfo.ioDrParID;
- }
-
- if (HasAUX())
- pathName.Insert("/", 1);
-
- return err;
-
- } // TFile::GetPathName
-
- //----------------------------------------------------------------------------------------
- // TFile::GetPhysicalSize:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileWrite
-
- OSErr TFile::GetPhysicalSize(long& dataSize,
- long& rsrcSize)
- {
- HParamBlockRec pb;
- OSErr theErr;
-
- if ((theErr = this->GetFileInfo(pb)) == noErr)
- {
- dataSize = pb.fileParam.ioFlPyLen;
- rsrcSize = pb.fileParam.ioFlRPyLen;
- }
- return theErr;
- } // TFile::GetPhysicalSize
-
- //----------------------------------------------------------------------------------------
- // TFile::GetScript:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- OSErr TFile::GetScript(ScriptCode& theScript)
- {
- OSErr theErr;
- CInfoPBRec cInfo;
-
- BlockSet((Ptr) & cInfo, sizeof(CInfoPBRec), 0x00);// zero-out our storage
- theErr = this->GetCatInfo(cInfo);
- if (theErr == noErr)
- {
- theScript = cInfo.hFileInfo.ioFlXFndrInfo.fdScript;
- fScriptTag = theScript;
- }
- return theErr;
- } // TFile::GetScript
-
- //----------------------------------------------------------------------------------------
- // TFile::SetModificationDate:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- OSErr TFile::SetModificationDate(long modificationDate)
- {
- // Get the current information and just touch the modification date
- CInfoPBRec cInfo;
- OSErr theErr = noErr;
-
- BlockSet((Ptr) & cInfo, sizeof(CInfoPBRec), 0x00);// zero-out our storage
- if (this->GetCatInfo(cInfo) == noErr)
- {
- Boolean isDirectory = ((cInfo.hFileInfo.ioFlAttrib & ioDirMask) != 0);
- if (isDirectory)
- cInfo.dirInfo.ioDrMdDat = modificationDate;
- else
- cInfo.hFileInfo.ioFlMdDat = modificationDate;
-
- this->SetCatInfo(cInfo);
- }
-
- return theErr;
- } // TFile::SetModificationDate
-
- //----------------------------------------------------------------------------------------
- // TFile::SetCreationDate:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- OSErr TFile::SetCreationDate(long creationDate)
- {
- // Get the current information and just touch the modification date
- CInfoPBRec cInfo;
- OSErr theErr = noErr;
-
- BlockSet((Ptr) & cInfo, sizeof(CInfoPBRec), 0x00);// zero-out our storage
- if (this->GetCatInfo(cInfo) == noErr)
- {
- Boolean isDirectory = ((cInfo.hFileInfo.ioFlAttrib & ioDirMask) != 0);
- if (isDirectory)
- cInfo.dirInfo.ioDrCrDat = creationDate;
- else
- cInfo.hFileInfo.ioFlCrDat = creationDate;
-
- this->SetCatInfo(cInfo);
- }
-
- return theErr;
- } // TFile::SetCreationDate
-
- //----------------------------------------------------------------------------------------
- // TFile::SetFinderInfo:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- OSErr TFile::SetFinderInfo(const FInfo& fndrInfo)
- {
- HParamBlockRec pb;
- OSErr theErr = noErr;
-
- // Get the current information and just touch the finder info
- theErr = this->GetFileInfo(pb);
- if (theErr == noErr)
- {
- pb.fileParam.ioFlFndrInfo = fndrInfo;
- theErr = this->SetFileInfo(pb);
- }
- return theErr;
- } // TFile::SetFinderInfo
-
- //----------------------------------------------------------------------------------------
- // TFile::FlushVolume:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileWrite
-
- OSErr TFile::FlushVolume()
- {
- return FlushVol(NULL, fFileSpec.vRefNum);
- } // TFile::FlushVolume
-
- //----------------------------------------------------------------------------------------
- // TFile::GetBlockSize:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileWrite
-
- OSErr TFile::GetBlockSize(long& blockSize)
- {
- HParamBlockRec pb;
- OSErr theErr;
-
- BlockSet((Ptr) & pb, sizeof(HParamBlockRec), 0x00);// zero-out our storage
- theErr = this->GetVolumeInfo(pb);
- if (theErr == noErr)
- blockSize = pb.volumeParam.ioVAlBlkSiz;
- else
- blockSize = 0;
- return theErr;
- } // TFile::GetBlockSize
-
- //----------------------------------------------------------------------------------------
- // TFile::GetFreeBlocks:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileWrite
-
- OSErr TFile::GetFreeBlocks(long& freeBlocks)
- {
- HParamBlockRec pb;
- OSErr theErr;
-
-
- BlockSet((Ptr) & pb, sizeof(HParamBlockRec), 0x00);// zero-out our storage
- theErr = this->GetVolumeInfo(pb);
- if (theErr == noErr)
- freeBlocks = pb.volumeParam.ioVFrBlk;
- else
- freeBlocks = 0;
- return theErr;
- } // TFile::GetFreeBlocks
-
- //----------------------------------------------------------------------------------------
- // TFile::GetVolumeInfo:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileWrite
-
- OSErr TFile::GetVolumeInfo(HParamBlockRec& pb)
- {
- pb.volumeParam.ioCompletion = NULL;
- pb.volumeParam.ioNamePtr = NULL;
- pb.volumeParam.ioVRefNum = fFileSpec.vRefNum;
- pb.volumeParam.ioVolIndex = -1; // Use the vRefNum since it is all we have
- return PBHGetVInfoSync(&pb);
- } // TFile::GetVolumeInfo
-
- //----------------------------------------------------------------------------------------
- // TFile::GetVolumeName:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- OSErr TFile::GetVolumeName(CStr63& name)
- {
- HParamBlockRec pb;
-
- BlockSet((Ptr) & pb, sizeof(HParamBlockRec), 0x00);
- pb.volumeParam.ioNamePtr = (StringPtr) name; // Fill in the name
- pb.volumeParam.ioVRefNum = fFileSpec.vRefNum;
- pb.volumeParam.ioVolIndex = 0; // Use the vRefNum since it is all we have
- return PBHGetVInfoSync(&pb);
- } // TFile::GetVolumeName
-
- //----------------------------------------------------------------------------------------
- // TFile::GetVolRefNum:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileOpen
-
- short TFile::GetVolRefNum()
- {
- return fFileSpec.vRefNum;
- } // TFile::GetVolRefNum
-
- //----------------------------------------------------------------------------------------
- // TFile::IsDataForkOpen:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileOpen
-
- Boolean TFile::IsDataForkOpen()
- {
- return (fDataRefNum != kNoFileRefnum);
- } // TFile::IsDataForkOpen
-
- //----------------------------------------------------------------------------------------
- // TFile::IsRsrcForkOpen:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileOpen
-
- Boolean TFile::IsRsrcForkOpen()
- {
- return (fRsrcRefNum != kNoFileRefnum);
- } // TFile::IsRsrcForkOpen
-
- //----------------------------------------------------------------------------------------
- // TFile::IsSameFile:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileOpen
-
- Boolean TFile::IsSameFile(TFile* aFile)
- {
- // See if aFile represents the same file as this.
- this->UpdateFileSpec(); // Make sure we're up-to-date.
-
-
- if ((fFileSpec.vRefNum == aFile->GetVolRefNum())
- && (fFileSpec.parID == aFile->GetDirID()))
- {
- CStr63 name;
-
- aFile->GetName(name);
- return (EqualString(*((CString *) fFileSpec.name), name, FALSE, TRUE));
- }
- return FALSE;
- } // TFile::IsSameFile
-
- //----------------------------------------------------------------------------------------
- // TFile::IsStationery:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileOpen
-
- Boolean TFile::IsStationery()
- {
- return fStationery;
- } // TFile::IsStationery
-
- //----------------------------------------------------------------------------------------
- // TFile::IsModified:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- Boolean TFile::IsModified()
- {
- long theDate;
-
- theDate = this->GetModificationDate();
- if (theDate != fModDate)
- return TRUE;
- else
- return FALSE;
- } // TFile::IsModified
-
- //----------------------------------------------------------------------------------------
- // TFile::IsVolumeLocked:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- OSErr TFile::IsVolumeLocked(Boolean& locked)
- {
- HParamBlockRec pb;
- OSErr theErr;
-
- if ((theErr = this->GetVolumeInfo(pb)) == noErr)
- locked = ((pb.volumeParam.ioVAtrb & 0x8080) != 0);
- return theErr;
- } // TFile::IsVolumeLocked
-
- //----------------------------------------------------------------------------------------
- // TFile::HasDataFork:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- Boolean TFile::HasDataFork()
- {
- return fUsesDataFork;
- } // TFile::HasDataFork
-
- //----------------------------------------------------------------------------------------
- // TFile::HasRsrcFork:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileRes
-
- Boolean TFile::HasRsrcFork()
- {
- return (fUsesRsrcFork != noResourceFork);
- } // TFile::HasRsrcFork
-
- //----------------------------------------------------------------------------------------
- // TFile::HasValidFileSpec:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- Boolean TFile::HasValidFileSpec()
- {
- return ((fFileSpec.vRefNum != 0) || (fFileSpec.parID != 0));
- } // TFile::HasValidFileSpec
-
- //----------------------------------------------------------------------------------------
- // TFile::Modified:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- void TFile::Modified()
- {
- fModDate = this->GetModificationDate();
-
- FInfo info;
- FailOSErr(this->GetFinderInfo(info));
-
- if (fAlias != NULL)
- fAlias = (AliasHandle)DisposeIfHandle((Handle)fAlias);
- FailOSErr(NewAliasMinimal(&fFileSpec, &fAlias));
- } // TFile::Modified
-
- //----------------------------------------------------------------------------------------
- // TFile::MoveAndRename:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileWrite
-
- OSErr TFile::MoveAndRename(const FSSpec& dest)
- {
- CInfoPBRec cInfoPB;
- CMovePBRec cMovePB;
- CStr255 sourceName; // needs to be CStr255 for call to HRename
- CStr63 destName;
- long parentDirID;
- OSErr theErr;
-
- cInfoPB.dirInfo.ioVRefNum = dest.vRefNum;
- cInfoPB.dirInfo.ioDrDirID = dest.parID;
- cInfoPB.dirInfo.ioNamePtr = (StringPtr) destName; // Will be filled in
- cInfoPB.dirInfo.ioFDirIndex = -1;
- if ((theErr = PBGetCatInfoSync(&cInfoPB)) != noErr)
- return theErr;
- parentDirID = cInfoPB.dirInfo.ioDrParID;
-
- sourceName = fFileSpec.name;
- cMovePB.ioVRefNum = fFileSpec.vRefNum;
- cMovePB.ioDirID = fFileSpec.parID;
- cMovePB.ioNamePtr = (StringPtr) sourceName;
- cMovePB.ioNewDirID = parentDirID;
- cMovePB.ioNewName = (StringPtr) destName;
- if ((theErr = PBCatMoveSync(&cMovePB)) != noErr)
- return theErr;
- return HRename(dest.vRefNum, dest.parID, sourceName, (const CStr255&) dest.name);
- } // TFile::MoveAndRename
-
- //----------------------------------------------------------------------------------------
- // TFile::ReadData:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileRead
-
- OSErr TFile::ReadData(void* buffer,
- long& count)
- {
- return FSRead(fDataRefNum, &count, (Ptr)buffer);
- } // TFile::ReadData
-
- //----------------------------------------------------------------------------------------
- // TFile::ReadUntil:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileRead
-
- OSErr TFile::ReadUntil(void* buffer,
- long& count,
- char untilChar)
- {
- ParamBlockRec theParamBlock;
- OSErr theResult;
-
- if (fDataRefNum != kNoFileRefnum)
- {
- theParamBlock.ioParam.ioCompletion = NULL;
- theParamBlock.ioParam.ioRefNum = fDataRefNum;
- theParamBlock.ioParam.ioBuffer = (Ptr) buffer;
- theParamBlock.ioParam.ioReqCount = count;
- theParamBlock.ioParam.ioPosMode = fsAtMark | 0x0080 | (untilChar * 0x100);
- theResult = PBReadSync(&theParamBlock);
- count = theParamBlock.ioParam.ioActCount;
- return theResult;
- }
- else
- return noErr;
- } // TFile::ReadUnti
-
- //----------------------------------------------------------------------------------------
- // TFile::RenameFile:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileWrite
-
- OSErr TFile::RenameFile(const CStr63& newName)
- {
- return FSpRename(&fFileSpec, (ConstStr255Param)&newName);
- } // TFile::RenameFile
-
- //----------------------------------------------------------------------------------------
- // TFile::SetCatInfo:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileWrite
-
- OSErr TFile::SetCatInfo(CInfoPBRec& cInfo)
- {
- CStr63 fileName = fFileSpec.name;
-
- cInfo.hFileInfo.ioCompletion = NULL;
- cInfo.hFileInfo.ioNamePtr = (StringPtr) fileName;
- cInfo.hFileInfo.ioVRefNum = fFileSpec.vRefNum;
- cInfo.hFileInfo.ioDirID = fFileSpec.parID;
- OSErr err = PBSetCatInfoSync((CInfoPBRec*) &cInfo);
- cInfo.hFileInfo.ioNamePtr = NULL;
- return err;
- } // TFile::SetCatInfo
-
- //----------------------------------------------------------------------------------------
- // TFile::SetDataLength:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileWrite
-
- OSErr TFile::SetDataLength(long length)
- {
- return SetEOF(fDataRefNum, length);
- } // TFile::SetDataLength
-
- //----------------------------------------------------------------------------------------
- // TFile::SetDataMark:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileWrite
-
- OSErr TFile::SetDataMark(long mark,
- short fromWhere)
- {
- return SetFPos(fDataRefNum, fromWhere, mark);
- } // TFile::SetDataMark
-
- //----------------------------------------------------------------------------------------
- // TFile::SetFileInfo:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- OSErr TFile::SetFileInfo(HParamBlockRec& pb)
- {
- CStr63 fileName = fFileSpec.name;
-
- pb.fileParam.ioNamePtr = (StringPtr) fileName;
- pb.fileParam.ioVRefNum = fFileSpec.vRefNum;
- pb.fileParam.ioDirID = fFileSpec.parID;
- OSErr err = PBHSetFInfoSync((HParamBlockRec*) &pb);
- pb.fileParam.ioNamePtr = NULL;
- return err;
- } // TFile::SetFileInfo
-
- //----------------------------------------------------------------------------------------
- // TFile::SetName:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileRes
-
- void TFile::SetName(const CStr63& newName)
- {
- newName.CopyTo(fFileSpec.name);
- } // TFile::SetName
-
- //----------------------------------------------------------------------------------------
- // TFile::SetScript:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileWrite
-
- OSErr TFile::SetScript(ScriptCode theScript)
- {
- OSErr theErr;
- CInfoPBRec cInfo;
-
- // Get the current info so we don't have to set up the entire record
- if ((theErr = this->GetCatInfo(cInfo)) == noErr)
- {
- cInfo.hFileInfo.ioFlXFndrInfo.fdScript = theScript;
- theErr = this->SetCatInfo(cInfo);
- }
- return theErr;
- } // TFile::SetScript
-
- //----------------------------------------------------------------------------------------
- // TFile::SetPermissions:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileWrite
-
- void TFile::SetPermissions(SignedByte dataPermission,
- SignedByte rsrcPermission)
- {
- fDataPermission = dataPermission;
- fRsrcPermission = rsrcPermission;
- } // TFile::SetPermissions
-
- //----------------------------------------------------------------------------------------
- // TFile::UpdateFileSpec:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileWrite
-
- Boolean TFile::UpdateFileSpec()
- {
- // Before we go using the aFile's information we must make sure it's
- // up-to-date (things might have change in the Finder, for example, such
- // as moving the file to another folder on the same volume or renaming
- // the file.
-
- Boolean wasChanged = FALSE;
-
- if (fAlias != NULL)
- {
- // We can't just fail if no interaction is allowed before resolving the alias
- // because there may be no need for user interaction.
- OSErr anErr = noErr;
- anErr = MAInteractWithUser();
- if (anErr == errAENoUserInteraction)
- {
- // No interaction is allowed so just attempt to resolve the alias without UI.
- FSSpec theFileSpec; // Resulting file spec goes here.
- Boolean updateAlias = FALSE;
- short myMatchCount = 1;
-
- // First try the absolute search method.
- anErr = MatchAlias(NULL, // fromFile
- kARMMountVol
- + kARMSearch
- + kARMNoUI, // rulesMask
- fAlias, // alias
- &myMatchCount, // aliasCount
- &theFileSpec, // aliasList (FSSpecArrayPtr)
- &updateAlias, // needsUpdate
- NULL, // aliasFilter
- NULL); // yourDataPtr);
- }
- else
- anErr = ResolveAlias(NULL, fAlias, &fFileSpec, &wasChanged);
-
- if (anErr != userCanceledErr)
- FailOSErr(anErr);
- }
-
- return wasChanged;
- }
-
- //----------------------------------------------------------------------------------------
- // TFile::UpdateResource:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- OSErr TFile::UpdateResource()
- {
- UpdateResFile(fRsrcRefNum);
- return ResError();
- } // TFile::UpdateResource
-
- //----------------------------------------------------------------------------------------
- // TFile::UseResource:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileNonRes
-
- short TFile::UseResource()
- {
- return MAUseResFile(fRsrcRefNum);
- } // TFile::UseResource
-
- //----------------------------------------------------------------------------------------
- // TFile::WriteData:
- //----------------------------------------------------------------------------------------
- #pragma segment MAFileWrite
-
- OSErr TFile::WriteData(const void* buffer,
- long& count)
- {
- return FSWrite(fDataRefNum, &count, buffer);
- } // TFile::WriteData
-
- //----------------------------------------------------------------------------------------
- // TFile::GetObjectProperty:
- //----------------------------------------------------------------------------------------
- #pragma segment MAScriptingRes
-
- Boolean TFile::GetObjectProperty(CAEDesc& thePropertyValue,
- DescType whichProperty,
- const CAEDesc& desiredType)
- {
- Boolean hasProperty = TRUE;
- FailInfo fi;
- Try(fi)
- {
- switch (whichProperty)
- {
- case pName:
- {
- CStr255 thePathName;
- if (this->GetPathName(thePathName) == noErr)
- {
- CStr63 theFileName;
- this->GetName(theFileName);
- thePropertyValue.PutString(thePathName + theFileName);
- }
- break;
- }
-
- case pIsStationeryPad:
- thePropertyValue.PutBoolean(this->IsStationery());
- break;
-
- default:
- hasProperty = MScriptableObject::GetObjectProperty(thePropertyValue, whichProperty, desiredType);
- break;
- }
- fi.Success();
- }
- else
- {
- hasProperty = FALSE;
- }
- return hasProperty;
- }
-
- //----------------------------------------------------------------------------------------
- // TFile::SetObjectProperty:
- //----------------------------------------------------------------------------------------
- #pragma segment MAScriptingRes
-
- void TFile::SetObjectProperty(const CAEDesc& thePropertyValue,
- DescType whichProperty)
- {
- switch (whichProperty)
- {
- case pName:
- case pIsStationeryPad:
- FailOSErr(errAECantSetReadOnly);
- break;
-
- default:
- MScriptableObject::SetObjectProperty(thePropertyValue, whichProperty);
- break;
- }
- }
-
- //----------------------------------------------------------------------------------------
- // End of UFile.cp
-
- #pragma segment Inline
-